import type { ComponentType } from 'react';
import {
    DatePicker,
    Input,
    Select,
    Radio,
    Switch,
    Slider,
    Rate,
    Transfer,
    Upload,
    TreeSelect,
    InputNumber,
    AutoComplete,
    Cascader,
    Checkbox,
    ColorPicker,
    TimePicker,
    Mentions,
    Tag
} from 'antd';
import SlButtonGroup from '@/components/SlButtonGroup';
import SlIconSelect from '@/components/SlIconSelect';
import SlRemoteSelect from "@/components/SlRemoteSelect";
import SlTree from "@/components/SlTree";
// 1. 定义更精确的类型
type AntdComponentType =
    | typeof Input
    | typeof Select
    | typeof Radio
    | typeof Switch
    | typeof Slider
    | typeof Rate
    | typeof Transfer
    | typeof Upload
    | typeof TreeSelect
    | typeof DatePicker
    | typeof Input.Password
    | typeof Input.TextArea
    | typeof Input.Search
    | typeof AutoComplete
    | typeof Cascader
    | typeof Checkbox
    | typeof ColorPicker
    | typeof TimePicker
    | typeof DatePicker.RangePicker
    | typeof Mentions
    | typeof SlButtonGroup
    | typeof SlIconSelect
    | typeof SlRemoteSelect
    | typeof SlTree

const componentMap: Record<string, AntdComponentType | ComponentType<any>> = {
    Input: Input,
    Search: Input.Search,
    InputNumber: InputNumber,
    InputPassword: Input.Password,
    Select: Select,
    Radio: Radio,
    RadioGroup: Radio.Group,
    Switch: Switch,
    Slider: Slider,
    Transfer: Transfer,
    TreeSelect: TreeSelect,
    Upload: Upload,
    DatePicker: DatePicker,
    DateRangePicker: DatePicker.RangePicker,
    DateTimePicker: DatePicker.TimePicker,
    DateMonthPicker: DatePicker.MonthPicker,
    DateYearPicker: DatePicker.YearPicker,
    DateWeekPicker: DatePicker.WeekPicker,
    TimePicker: TimePicker,
    TimeRangePicker: TimePicker.RangePicker,
    Textarea: Input.TextArea,
    AutoComplete: AutoComplete,
    Tag: Tag,
    Cascader: Cascader,
    Checkbox: Checkbox,
    CheckboxGroup: Checkbox.Group,
    ColorPicker: ColorPicker,
    Mentions: Mentions,
    ButtonGroup: SlButtonGroup,
    IconSelect: SlIconSelect,
    RemoteSelect: SlRemoteSelect,
    Tree: SlTree
};

export { componentMap };
